using System;
using UnityEngine;

public class FPCamera : MonoBehaviour
{
    public float MovementSpeed;
    public float MouseXSensitivity;
    public float MouseYSensitivity;

    public Vector2 MaxYAngle;

    private Transform selfTrans;
    private Vector3 currentRot;

    private void Start()
    {
        selfTrans = transform;
    }

    private void Update()
    {
        var tmp_MouseX = Input.GetAxis("Mouse X");
        var tmp_MouseY = Input.GetAxis("Mouse Y");
        currentRot.x -= tmp_MouseY * MouseXSensitivity;
        currentRot.y += tmp_MouseX * MouseYSensitivity;

        currentRot.x = Mathf.Clamp(currentRot.x, MaxYAngle.x, MaxYAngle.y);

        selfTrans.localEulerAngles = currentRot;
    }
}